package com.shangxia.monomer.study.base.annotationDemo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.shangxia.monomer.business.base.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Var;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @ProjectName: monomer
 * @ClassName: AnnotationDemo
 * @Time: 2021/8/1
 * @Author: zhouy
 * @Description:
 * @Experience:
 */

@Slf4j
public class AnnotationDemo {
    public static void main(String[] args) {
        //获取私有属性
        Field[] fields = User.class.getDeclaredFields();

        for (Field field : fields) {
            TableField annotation = field.getAnnotation(TableField.class);
            if (null != annotation) {
                System.out.println(field.getName() + " : " + annotation.value());
            } else {
                System.out.println(field.getName());
            }
        }

    }
}
